/* 
  纯css制作一些静态时可以使用input 可点击标签搭配label标签
  来达到一些点击的css效果，此效果一般为checked选中形态
 */
body{
    width: 100vw;
    background-color: #f2f2f2;
}

.navbar{
    position: relative;
    width: 100%;
    height: 50px;
    line-height: 50px;
    background-color: #fff;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .1);
}

.navbar input{
  display: none;
}

.navbar label{
    position: absolute;
    top: 0;
    left: 200px;
    font-size: 20px;
    color: #666;
    padding-left: 20px;
    cursor: pointer;
    transition: all .5s;
}

.navbar ul{
    position: absolute;
    top: 0;
    left: 0;
    width: 200px;
    height: 100vh;
    background-color: #20222a;
    transition: all .5s;
}

.navbar ul li{
    width: 100%;
    height: 70px;
    margin-bottom: 10px;
}

.navbar ul li:first-child{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 150px;
    padding: 10px;
}

.navbar ul li:first-child img{
    width: 80px;
    border-radius: 50%;
}

.navbar ul li:first-child span{
    color: #fff;
    font-size: 14px;
    white-space: nowrap;
}

.navbar ul li a {
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    color: #d2d2d2;
    border-left: 6px solid transparent;
}

.navbar ul li a i{
    font-size: 18px;
    margin: 0 15px;
}

.navbar ul li a span{
    font-size: 14px;
}

.navbar ul li a:hover{
    color: #fff;
    border-left-color:#fb9799;
}

/* 利用label选中复选框使label距离左侧为0 */
.navbar input:checked + label{
    left: 0;
}

/* 切换图标 */
/* 这里旋转180度使图标倒置 */
.navbar input:checked + label i{
    transform: rotateY(180deg);
}

/* 选中复选框后使ul距离左边为-200px,即隐藏左侧栏 */
.navbar input:checked ~ ul{
    left: -200px;
}
